#ifndef Trace_h
#define Trace_h

class Trace_T
{
private:
	Trace_T();
	~Trace_T();

public:
	static void WriteDebug(const char * format, ...)
	{
		char dataBuffer[0x400];
		FillMemory(dataBuffer, sizeof(dataBuffer), 0);

		va_list args;
		va_start(args, format);
		_vsnprintf(dataBuffer, sizeof(dataBuffer) - 1, format, args);
		va_end(args);

		OutputDebugStringA(dataBuffer);
	}

	static void WriteEvent(const char * format, ...)
	{
		char dataBuffer[0x400];
		FillMemory(dataBuffer, sizeof(dataBuffer), 0);

		va_list args;
		va_start(args, format);
		_vsnprintf(dataBuffer, sizeof(dataBuffer) - 1, format, args);
		va_end(args);

		HANDLE hLog = OpenEventLogA(0, EVENTLOG_SOURCE);
		if( !hLog )
		{
			return;
		}

		char * eventText = dataBuffer;
		ReportEventA(hLog, EVENTLOG_ERROR_TYPE, 0, 0, 0, 1, 0, (LPCSTR *)&eventText, 0);
		CloseEventLog(hLog);
	}
};

#endif //Trace_h